var http=require("http");
var url =require("url");

function start(handle,route){
  function onRequest(req,res){
     var pathname=url.parse(req.url).pathname;
     console.log("SERVER.JS:Request for "+pathname+" received.");

     route(handle,pathname);

     res.writeHead(200,{"Count-Type":"text/plain"});

     res.write("Hello world!");
     res.end();
  }
  
  http.createServer(onRequest).listen(8888); 
  console.log("server has started");
}


exports.start=start;
